var mongo = require('mongoskin');
var db = mongo.db("mongodb://localhost:27017/blog", {native_parser:true});

module.exports = function(req, res, next){

	req.users = db.collection("users");

	req.comments = db.collection("comments");

	req.popo = db.collection("popo");

	req.danmu = db.collection("danmu");

	req.VandB = db.collection("VandB");

	req.record = db.collection("record");

	req.admin = db.collection("admin");

	req.dbid = function(arrayId){

		return mongo.helper.toObjectID(arrayId);

	}

	return next();

}
